package org.example.observe.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.example.observe.service.OrderEvent;
import org.example.observe.service.OrderObserve;
import org.example.observe.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 库存业务:需要进行发货
 */
@Slf4j
@Service
public class GoodsServiceImpl implements OrderObserve ,
        ApplicationListener<OrderEvent> {// Spring方式
    @Override
    public void paySuccess(String orderNo) {
        log.info("库存业务:进行发货,{}",orderNo);
    }

    @Override
    public void onApplicationEvent(OrderEvent event) {
        log.info("库存业务:进行发货,{}",event.getSource());
    }
}
